package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "inventory_flow", schema = "crm")
public class InventoryFlow {
    private int inventoryFlowId;
    private Integer inventoryFlowClassify;
    private Product productByProductId;
    private Storage storageByStorageId;
    private StorageDetail stoDetailByStoDetailId;
    private Outbound outboundByOutboundId;
    private OutboundDetail outDetailByOutDetailId;

    @Id
    @Column(name = "inventory_flow_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getInventoryFlowId() {
        return inventoryFlowId;
    }

    public void setInventoryFlowId(int inventoryFlowId) {
        this.inventoryFlowId = inventoryFlowId;
    }

    @Basic
    @Column(name = "inventory_flow_classify", nullable = true)
    public Integer getInventoryFlowClassify() {
        return inventoryFlowClassify;
    }

    public void setInventoryFlowClassify(Integer inventoryFlowClassify) {
        this.inventoryFlowClassify = inventoryFlowClassify;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        InventoryFlow that = (InventoryFlow) o;
        return inventoryFlowId == that.inventoryFlowId &&
                Objects.equals(inventoryFlowClassify, that.inventoryFlowClassify);
    }

    @Override
    public int hashCode() {
        return Objects.hash(inventoryFlowId, inventoryFlowClassify);
    }

    @ManyToOne
    @JoinColumn(name = "storage_id", referencedColumnName = "storage_id")
    public Storage getStorageByStorageId() {
        return storageByStorageId;
    }

    public void setStorageByStorageId(Storage storageByStorageId) {
        this.storageByStorageId = storageByStorageId;
    }


    @ManyToOne
    @JoinColumn(name = "storage_detail_id", referencedColumnName = "storage_detail_id")
    public StorageDetail getStoDetailByStoDetailId() {
        return stoDetailByStoDetailId;
    }

    public void setStoDetailByStoDetailId(StorageDetail stoDetailByStoDetailId) {
        this.stoDetailByStoDetailId = stoDetailByStoDetailId;
    }


    @ManyToOne
    @JoinColumn(name = "outbound_id", referencedColumnName = "outbound_id")
    public Outbound getOutboundByOutboundId() {
        return outboundByOutboundId;
    }

    public void setOutboundByOutboundId(Outbound outboundByOutboundId) {
        this.outboundByOutboundId = outboundByOutboundId;
    }

    @ManyToOne
    @JoinColumn(name = "outbound_detail_id", referencedColumnName = "outbound_detail_id")
    public OutboundDetail getOutDetailByOutDetailId() {
        return outDetailByOutDetailId;
    }

    public void setOutDetailByOutDetailId(OutboundDetail outDetailByOutDetailId) {
        this.outDetailByOutDetailId = outDetailByOutDetailId;
    }

    @ManyToOne
    @JoinColumn(name = "product_id", referencedColumnName = "product_id")
    public Product getProductByProductId() {
        return productByProductId;
    }

    public void setProductByProductId(Product productByProductId) {
        this.productByProductId = productByProductId;
    }
}
